package com.thb.pay.controller;


import com.thb.pay.api.sys.SysConfigServiceApi;
import com.thb.pay.core.utils.PageResult;
import com.thb.pay.service.SysConfigService;
import com.thb.pay.vo.req.SysConfigPageReq;
import com.thb.pay.vo.req.SysConfigReq;
import com.thb.pay.vo.resp.SysConfigVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 系统-配置表 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@RestController
public class SysConfigController implements SysConfigServiceApi {

    @Autowired
    private SysConfigService sysConfigService;

    @Override
    public PageResult<SysConfigVo> findPage(@RequestBody SysConfigPageReq pageReq) {
        return sysConfigService.findPage(pageReq);
    }

    @Override
    public List<SysConfigVo> findListByType(@RequestParam("type") String type) {
        return sysConfigService.findListByType(type);
    }

    @Override
    public SysConfigVo getByCode(@RequestParam("code") String code) {
        return sysConfigService.getByCode(code);
    }

    @Override
    public void updateAll(@RequestBody List<SysConfigReq> configReqList) {
        sysConfigService.updateAll(configReqList);
    }

    @Override
    public void save(@RequestBody SysConfigReq configReq) {
        sysConfigService.save(configReq);
    }
}
